* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
}

body {
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
    padding: 20px;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    background: white;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #1a6dcc, #0d4a9e);
    color: white;
    padding: 20px 30px;
    text-align: center;
}

header h1 {
    font-size: 28px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

main {
    padding: 30px;
}

.form-container {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* 左右布局容器 */
.form-sections-container {
    display: flex;
    gap: 25px;
    align-items: flex-start;
}

.form-section {
    background: #f8f9fc;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    flex: 1;
    min-height: 400px;
}

.form-section h2 {
    font-size: 18px;
    color: #1a6dcc;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e6f0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
}

label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #444;
    display: flex;
    align-items: center;
    gap: 5px;
}

input, select {
    padding: 12px 15px;
    border: 1px solid #d1d7e0;
    border-radius: 6px;
    font-size: 16px;
    transition: all 0.3s;
    background: white;
}

input:focus, select:focus {
    outline: none;
    border-color: #1a6dcc;
    box-shadow: 0 0 0 3px rgba(26, 109, 204, 0.1);
}

input:disabled, select:disabled {
    background-color: #f5f5f5 !important;
    color: #999 !important;
    cursor: not-allowed !important;
    border-color: #ddd !important;
}

.length-indicator {
    display: block;
    font-size: 0.9em;
    color: #666;
    margin-top: 4px;
}

.length-indicator.warning {
    color: #ff4444;
}

.length-indicator.warning {
    color: #ff4444;
    font-weight: bold;
}

/* 特殊备注样式 */
.special-remark {
    display: block;
    font-size: 0.9em;
    color: #1a6dcc;
    margin-top: 8px;
    padding: 8px 12px;
    background: #e3f2fd;
    border-radius: 6px;
    border-left: 3px solid #1a6dcc;
    line-height: 1.4;
}

.special-remark i {
    margin-right: 6px;
    color: #1a6dcc;
}

/* 检测类型复选框样式 */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

.checkbox-item:hover {
    background: #e9ecef;
    border-color: #1a6dcc;
}

.checkbox-item input[type="checkbox"],
.checkbox-item input[type="radio"] {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    accent-color: #1a6dcc;
}

.checkbox-item label {
    margin: 0;
    cursor: pointer;
    font-weight: 500;
    color: #495057;
    flex: 1;
}

.checkbox-item input[type="checkbox"]:checked + label,
.checkbox-item input[type="radio"]:checked + label {
    color: #1a6dcc;
    font-weight: 600;
}

.form-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 10px;
}

.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #1a6dcc, #0d4a9e);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0d4a9e, #1a6dcc);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(13, 74, 158, 0.3);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(108, 117, 125, 0.3);
}

.btn:hover {
    transform: translateY(-2px);
}

/* 加载动画 */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

footer {
    text-align: center;
    padding: 20px;
    background: #f1f5f9;
    color: #666;
    font-size: 14px;
    border-top: 1px solid #e0e6f0;
}

/* 打印页面样式 */
.print-container {
    display: none;
    max-width: 23cm;
    margin: 0 auto;
    background: white;
    padding: 1cm;
}

.print-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 20px;
    background: #f8f9fc;
    border-bottom: 1px solid #e0e6f0;
    margin-bottom: 20px;
}

.print-mode-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e6f0;
}

.print-mode-label {
    font-weight: 600;
    color: #444;
    margin-right: 10px;
}

.print-mode-btn {
    padding: 8px 16px;
    font-size: 14px;
}

.print-mode-btn.active {
    background: linear-gradient(135deg, #1a6dcc, #0d4a9e);
    color: white;
}

.print-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
}

/* A4页面样式 */
.a4-page {
    width: 21cm;
    min-height: 29.7cm;
    margin: 0 auto;
    padding: 1cm;
    background: white;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    position: relative;
    box-sizing: border-box;
    page-break-after: always;
}

/* 条码标签页面样式 - 针对TSC TTP-244M Pro优化 */
.label-page {
    width: 7.5cm;
    height: 4.5cm;
    margin: 0 auto;
    padding: 0.1cm;
    background: white;
    border: 1px solid #ddd;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    margin-bottom: 10px;
}

/* TSC打印机专用优化 */
.label-card .barcode-info {
    font-size: 9px;
    line-height: 1.1;
}

.label-card .info-row {
    margin-bottom: 1px;
}

.label-card .barcode-image {
    margin: 3px 0;
}

/* A4打印网格容器 */
.a4-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(5, 1fr);
    gap: 0;
    height: 25cm;
    margin: 0 auto;
}

/* A4打印卡片样式 */
.a4-card {
    border: 1px solid #000;
    padding: 8px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    font-size: 10px;
    line-height: 1.2;
}

.a4-card:nth-child(2n) {
    border-left: none;
}

.a4-card:nth-child(n+11) {
    border-top: none;
}

/* 条码标签卡片样式 */
.label-card {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-size: 10px;
    line-height: 1.2;
}

/* 条码信息样式 */
.barcode-info {
    flex-shrink: 0;
}

.info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2px;
}

.info-group {
    display: flex;
    align-items: center;
}

.barcode-info-label {
    font-weight: bold;
    margin-right: 3px;
    flex-shrink: 0;
}

/* A4模式下的标签宽度 */
.a4-card .barcode-info-label {
    width: 40px;
}

/* 条码标签模式下的标签宽度 - TSC优化 */
.label-card .barcode-info-label {
    width: 32px;
    font-size: 9px;
}

/* 条码图像样式 */
.barcode-image {
    text-align: center;
    margin: 5px 0;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 条码编号样式 */
.barcode-number {
    font-family: monospace;
    text-align: center;
    font-weight: bold;
    letter-spacing: 1px;
    flex-shrink: 0;
    margin-top: 5px;
}

.a4-card .barcode-number {
    font-size: 11px;
}

.label-card .barcode-number {
    font-size: 11px;
    font-family: 'Courier New', monospace;
}

/* 打印媒体查询 */
@media print {
    .print-actions, 
    .print-actions * {
        display: none !important;
    }
    
    header, footer {
        display: none !important;
    }
    
    body {
        margin: 0 !important;
        padding: 0 !important;
        background: white !important;
    }
    
    .container {
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        background: white !important;
    }
    
    .print-container {
        display: block !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        background: white !important;
    }
    
    /* A4打印样式 */
    .a4-page {
        box-shadow: none !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 22cm !important;
        min-height: 29.7cm !important;
        page-break-after: always !important;
    }
    
    .a4-grid {
        margin: 0 !important;
        padding: 0 !important;
        width: 22cm !important;
        height: 31.1cm !important;
    }
    
    .a4-card {
        border: 1px solid #000 !important;
        padding: 8px !important;
        page-break-inside: avoid !important;
    }
    
            /* 条码标签打印样式 - TSC TTP-244M Pro优化 */
.label-container {
    display: block !important;
}

.label-page {
    width: 7.5cm !important;
    height: 4.5cm !important;
    margin: 0 !important;
    padding: 0.1cm !important;
    page-break-inside: avoid !important;
    page-break-after: always !important;
    display: block !important;
}

.label-page:last-child {
    page-break-after: auto !important;
}
    
    .label-card {
        width: 100% !important;
        height: 100% !important;
    }
    
    /* 条码图像打印样式 */
    .barcode-image svg {
        max-width: 100% !important;
        height: auto !important;
    }
    
    .a4-card .barcode-image svg {
        width: 5.5cm !important;
        height: 1.2cm !important;
    }
    
    .label-card .barcode-image svg {
        width: 5.2cm !important;
        height: 1.1cm !important;
    }
    
            @page {
    margin: 0 !important;
    size: A4 !important;
}

/* TSC TTP-244M Pro专用设置 */
@page label-print {
    size: 75mm 45mm !important;
    margin: 0 !important;
}

/* 条码标签模式下的页面设置 */
.label-page {
    page-break-after: always !important;
}

.label-page:last-child {
    page-break-after: auto !important;
}
}

@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
        gap: 15px;
    }

    .container {
        margin: 10px;
    }

    .a4-page {
        width: 100%;
        padding: 1cm;
        box-shadow: none;
    }

    header .btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    header h1 {
        font-size: 20px;
    }
}